<template>
  <div class="home">
    <el-container>
      <el-header>
        <div class="headdiv">
          <img src="../assets/img/logo.png" alt="">
          <el-button class="colorButton iconfont icon-tuichu" @click="signout">退出</el-button>
        </div>
      </el-header>
      <el-container>
        <el-aside>
          <!-- 测边栏 -->

          <el-menu default-active="2" class="el-menu-vertical-demo">
            <el-button class="menubutton iconfont icon-diannao" @click="Jump(JumpAddress.desktop)">桌面</el-button>
            <el-submenu index="1">
              <template slot="title">
                <i class="iconfont icon-feiji"></i>
                <span>视频管理</span>
              </template>
              <el-menu-item @click="Jump(JumpAddress.course)" index="1-1">视频管理</el-menu-item>
            </el-submenu>
            <el-submenu index="2">
              <template slot="title">
                <i class="iconfont icon-feiji"></i>
                <span>成员管理</span>
              </template>
              <el-menu-item-group>
                <el-menu-item @click="Jump(JumpAddress.user)" index="2-1">志愿者管理</el-menu-item>
                <el-menu-item @click="Jump(JumpAddress.useraudit)" index="2-2">志愿者审核</el-menu-item>
                <el-menu-item @click="Jump(JumpAddress.manager)" index="2-3">管理员管理</el-menu-item>
              </el-menu-item-group>


            </el-submenu>
            <el-submenu index="3">
              <template slot="title">
                <i class="iconfont icon-feiji"></i>
                <span>系统管理</span>
              </template>
              <el-menu-item @click="Jump(JumpAddress.notice)" index="3-1">系统公告</el-menu-item>
              <el-menu-item @click="Jump(JumpAddress.visit)" index="3-2">访问统计</el-menu-item>
              <el-menu-item @click="Jump(JumpAddress.setting)" index="3-3">系统设置</el-menu-item>
            </el-submenu>
          </el-menu>
        </el-aside>
        <el-main class="colorbj">
          <router-view></router-view>
        </el-main>
      </el-container>
    </el-container>
  </div>
</template>

<script>

export default {
  name: 'Home',
  data() {
    return {
      JumpAddress:{
        desktop:'/desktop',
        course:'/course',
        user:'/user',
        useraudit:'/user-audit',
        manager:'/manager',
        notice:'/notice',
        visit:'/visit',
        setting:'/setting'
      }
     
    }
  },
  methods: {
    // 获取点击的地址
    Jump(v) {
      console.log(v);
      this.activeIndes = v
      this.$router.push(v)
    },
    // 退出按钮
    signout (){
      sessionStorage.removeItem('token')
      this.$router.push('/login')
    }
  }


}
</script>

<style scoped>
.colorbj {
    background: #f5f7f9;
}
.home {
  height: 100%;
}

.el-container {
  height: 100%;
  overflow: hidden;
}

.headdiv {
  position: relative;
  height: 60px;
  line-height: 60px;
  line-height: 60px;
  background-color: #515a6e;
}

.el-header {
  padding: 0;
}

.headdiv>img {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 150px;
  height: 45px;
  left: 50px;
}

.colorButton {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  right: 50px;
  background: #515a6e;
  color: #fff;
  border: 0;
}
.icon-tuichu:before{
  margin-right: 8px;
}
.icon-diannao:before,
.icon-feiji:before {
  margin-left: 5px;
  margin-right: 10px;
}

.el-aside {
  width: 200px !important;
}

.menubutton {
  border: 0;
  width: 100%;
  text-align: left;
  margin-top: 10px;
}
</style>

